#include "ManagedLasoProvider.h"

 /* Subroutine */int SmartMathLibrary::LasoPack::ManagedLasoProvider::slager_
   (integer *n, integer *nband, integer *nstart, real *a, real *tmin, real
   *tmax)
{
  /* System generated locals */
  integer a_dim1, a_offset, i__1, i__2;
  real r__1, r__2;

  /* Local variables */
  static real temp;
  static integer i__, k, l, m;


  /*  THIS SUBROUTINE COMPUTES BOUNDS ON THE SPECTRUM OF A BY */
  /*  EXAMINING THE GERSCHGORIN CIRCLES. ONLY THE NEWLY CREATED */
  /*  CIRCLES ARE EXAMINED */

  /*  FORMAL PARAMETERS */


  /*  LOCAL VARIABLES */


  /*  FUNCTIONS CALLED */


  /* Parameter adjustments */
  a_dim1 =  *nband;
  a_offset = 1+a_dim1 * 1;
  a -= a_offset;

  /* Function Body */
  i__1 =  *n;
  for (k =  *nstart; k <= i__1; ++k)
  {
    temp = (float)0.;
    i__2 =  *nband;
    for (i__ = 2; i__ <= i__2; ++i__)
    {
      temp += (r__1 = a[i__ + k * a_dim1], abs(r__1));
      /* L10: */
    }
    /* L20: */
    l = min(k,  *nband);
    if (l == 1)
    {
      goto L40;
    }
    i__2 = l;
    for (i__ = 2; i__ <= i__2; ++i__)
    {
      m = k - i__ + 1;
      temp += (r__1 = a[i__ + m * a_dim1], abs(r__1));
      /* L30: */
    }
    L40: 
    /* Computing MIN */
    r__1 =  *tmin, r__2 = a[k *a_dim1 + 1] - temp;
    *tmin = min(r__1, r__2);
    /* Computing MAX */
    r__1 =  *tmax, r__2 = a[k *a_dim1 + 1] + temp;
    *tmax = max(r__1, r__2);
    /* L50: */
  }
  return 0;
} /* slager_ */
